package com.michael.utils.file;

import cn.hutool.crypto.SecureUtil;

import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.List;

/**
 * 类功能描述:
 * <pre>
 *   真实的文件
 * </pre>
 *
 * @author Michael
 * @version 1.0
 * @date 2020/8/7 16:46
 */
public class RealFile {

    private File file;
    private String MD5;
    private RealFileType realFileType;


    public static void main(String[] args) throws IOException {

        List<String> list = Arrays.asList(
                "detection:detectionOffer:add",
                "asdfsgsdfgsdf",
                "consumer:kdLaboratoryAddress"
        );
        list.forEach(item -> System.out.println(FileUtil.getStrMd5(item)));

        System.out.println();

        list.forEach(item -> System.out.println(SecureUtil.md5().digestHex(item)));
        //String md5 = FileUtil.getStrMd5();
        //System.out.println(md5);

        // 4142434445464748494a4b4c4d4e0000000000000000000000000000
        // 73646673646673646673646673660000000000000000000000000000
        // e69f98e59f8e67677364660000000000000000000000000000000000
        //ByteArrayInputStream is = new ByteArrayInputStream("consumer:kdLaboratoryAddress:add".getBytes());
        //String type = FileUtil.getFileType(is);
        //System.out.println(type);

        //Paths.get("");

        //String path = "D:\\develop\\Maven\\repository\\commons-codec\\commons-codec\\1.13\\commons-codec-1.13.jar";
        //String path = "D:\\develop\\Maven\\repository\\com\\alipay\\sdk\\alipay-sdk-java\\3.1.0\\alipay-sdk-java-3
        // .1.0.jar";

        //504b03041400000808006a5cf44e8ce893aabe090000f34d00001400
        //504b03040a000008080007b130500000000002000000000000000900
        //23212f62696e2f626173680a230a23202020202e2020205f5f5f5f20
        //String fileType = FileUtil.getFileType(new FileInputStream(new File(path)));
        //System.out.println(fileType);

        //String path = "D:\\Michael\\Desktop\\abc.rar";
        //String contentType = Files.probeContentType(Paths.get(path));
        //System.out.println(contentType);
        //
        //String fileName = Paths.get(path).getFileName().toString();
        //int i = fileName.lastIndexOf(46);
        //System.out.println(i);
        //String fileType = FileUtil.getFileType(new FileInputStream(new File(path)));
        //System.out.println(fileType);
    }
}
